package com.haixinga.commbiz.mgr.mq;

import org.apache.activemq.command.ActiveMQQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;


@Component
public class ActiveMQService {

    private static final Logger logger = LoggerFactory.getLogger(ActiveMQService.class);

    /** 注入 jms发送对象 **/
    @Autowired private JmsMessagingTemplate jmsTemplate;


    /** 发送活动通知 **/
    public void send(String mqName, String msg) {

        try{
            jmsTemplate.convertAndSend(new ActiveMQQueue(mqName), msg);

        }catch (Exception e){
            logger.error("mqSendError:", e);
        }
    }

}
